<fieldset>
	<legend><?php echo t('LBL_ACADEMY', 'academy');?></legend>
	<table width="100%">
		<tr>
			<td width="50%" style="vertical-align: top">
				<div class="cbaddnew">
					<a href="javascript:void(0);" class="button"
						id="loadStudyingProcessByAjax"><?php echo t('BTN_ADDNEW', 'studyingProcess'); ?></a>
				</div>
				<table class="grid g-academy" id="studyingprocesses">
					<tr>
						<th><?php echo t('LBL_BEGINNING_YEAR', 'studyingProcess') ?></th>
						<th><?php echo t('LBL_ENDING_YEAR', 'studyingProcess') ?></th>
						<th><?php echo t('LBL_ACADEMY_LEVEL', 'studyingProcess') ?></th>
						<th><?php echo t('LBL_SCHOOL_NAME', 'studyingProcess') ?></th>
						<th class="hideonview"></th>
					</tr>					
					<?php
					$index = 0;
					foreach ( $model->academy->studyingProcesses as $id => $item ) :
						if ($item != null) {
							$this->renderPartial ( '/studyingprocess/_form', array (
									'model' => $item,
									'index' => $id 
							) );
							$index++;
						}
					endforeach
					;
					?>
				</table>
			</td>
			<td width="30px"></td>
			<td style="vertical-align: top">
				<table class="form academy">
					<tr>
						<td class="label"><?php echo $form->label($model->academy, 'best_subject'); ?></td>
						<td class="input" style="width: 180px;">
							<?php echo $form->textField ( $model->academy, 'best_subject' );?> 
						</td>
					</tr>
					<tr>
						<td class="label"><?php echo $form->label($model->academy, 'major'); ?></td>
						<td class="input">
							<?php echo $form->textField ( $model->academy, 'major' );?> 
						</td>
					</tr>
					<tr>
						<td class="label"><?php echo $form->label($model->academy, 'certificate'); ?></td>
						<td class="input">
							<?php echo $form->textField ( $model->academy, 'certificate' );?> 
						</td>
					</tr>
					<tr>
						<td class="label"><?php echo $form->label($model->academy, 'language'); ?></td>
						<td class="input">
							<?php echo $form->textField ( $model->academy, 'language' );?> 
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</fieldset>
<?php
Yii::app ()->clientScript->registerCoreScript ( 'jquery' );
Yii::app ()->clientScript->registerScript ( 'loadstudyingprocess', '
var _index = ' . $index . ';
$("#loadStudyingProcessByAjax").click(function(e){
    e.preventDefault();
    var _url = "' . Yii::app ()->controller->createUrl ( "loadStudyingProcessByAjax", array (
		"load_for" => $this->action->id 
) ) . '&index="+_index;
    $.ajax({
        url: _url,
        success:function(response){
            $("#studyingprocesses").append(response);            
        }
    });
	_index++;
});
', CClientScript::POS_END );
?>